package com.genesis.yunnanji.view.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.genesis.yunnanji.R;
import com.genesis.yunnanji.adapter.EarningsAdapter;
import com.genesis.yunnanji.bean.EarningsBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 创建日期：2018/9/26 on 17:27
 * 作者:Kite
 * 描述:消费
 */
public class AllyConsumptionFragment extends BaseFragment{

    @BindView(R.id.rv_content)
    RecyclerView rvContent;

    private EarningsAdapter mAdapter;

    private List<EarningsBean> mList = new ArrayList<>();

    /**
     * Fragment 实例
     */
    public static AllyConsumptionFragment newInstance(Object... pramars) {
        AllyConsumptionFragment fragment = new AllyConsumptionFragment();
        fragment.setArguments(getBundle(pramars));
        return fragment;
    }

    @Override
    public View initView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_income_consumption, container, false);
        return view;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        getData();
    }

    private void getData() {
        mAdapter = new EarningsAdapter(rvContent, mList);
        mList.add(new EarningsBean("2018-09-26 14:54", "消费", "100.00", "154875452698522555", "1200"));
        mList.add(new EarningsBean("2018-09-26 14:54", "消费", "100.00", "154875452698522555", "1100"));
        mList.add(new EarningsBean("2018-09-26 14:54", "消费", "100.00", "154875452698522555", "1000"));
        mAdapter.getRecyclerView().setLayoutManager(new LinearLayoutManager(getActivity()));
        rvContent.setAdapter(mAdapter);
    }

}
